home *** CD-ROM | disk | FTP | other *** search
/ Network Supervisor's Toolkit / Network Supervisor's Toolkit.iso / novell / nw386 / nlm-9.386 < prev    next >
Text File  |  1996-07-10  |  8KB  |  263 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11. Chapter 9
  12. NetWare Loadable Modules
  13.  
  14.  
  15.  
  16. This section on the NetWare Loadable Module (NLM)
  17. discusses the following:
  18.  
  19.    ■ Features
  20.    ■ C RunTime Libraries
  21.    ■ Types of NLMs
  22.    ■ Loading an NLM
  23.  
  24.  
  25.  
  26. Features
  27.  
  28. A NetWare Loadable Module (NLM) is a program that you can
  29. load and unload from server memory while the server is
  30. running.  When loaded, NLMs link with and become part of
  31. the NetWare operating system as if they were hard-coded. 
  32. Yet when NLMs are unloaded from the NetWare operating
  33. system, they return all the memory and resources that the
  34. server allocated to them.  Because NLMs are modular and
  35. can be developed to meet a variety of needs, they add
  36. openness and flexibility to the NetWare Operating System.
  37. ------------------------------------------
  38.               NLM Features
  39.  
  40. NLM features such as the following add
  41. openness, modularity, and flexibility 
  42. to the NetWare operating system:
  43.  
  44. *  NLM's can be loaded and unloaded
  45.    while the server is running
  46.  
  47. *  NLM's can allocate and deallocate
  48.    memory as needed during loading
  49.    and unloading
  50.  
  51. *  NLM's can link with and access the
  52.    NetWare OS and other NLM's
  53.  
  54. ------------------------------------------
  55.  
  56. C RunTime Libraries
  57.  
  58. NLMs are similar to Value-Added Processes (VAPs) in that
  59. they reside in server memory with the NetWare operating
  60. system.  However, unlike VAPs that have limited access
  61. to NetWare through a set of Application Program Interface
  62. (API) system calls, NLMs have more direct access to a
  63. large number of server procedures.  These server
  64. procedures that NLMs can access are collectively called
  65. the Loadable Module Interface and are derived from the
  66. following APIs:
  67.  
  68.    ■ ANSI.C runtime library
  69.    ■ POSIX API
  70.    ■ Existing Microsoft, Borland, and Watcom C runtime
  71.      libraries
  72.    ■ OS/2 execution thread API
  73.    ■ NetWare C Interface library
  74.  
  75. Additional APIs encompassing features new in NetWare 386
  76. are also contained in the NetWare 386 C RunTime
  77. Libraries.  To develop an NLM using the NetWare C RunTime
  78. Libraries requires the following basic steps: ■Design and write the NLM using one of the following:
  79.  
  80.         C
  81.         386 protected mode assembly language
  82.         C++ using a preprocessor
  83.  
  84.    ■ Compile the code using Watcom 386 protected mode C
  85.      compiler, or assemble the program using Phar Lap's
  86.      386 protected mode assembler.
  87.  
  88.    ■ Using Novell's linker, NLMLINK, link the object
  89.      modules of the NLM with an object module called the
  90.      Prelude module, supplied with the Developers Kit. 
  91.      Access to all other NetWare 386 C RunTime Library
  92.      procedures is via the dynamic link facility of
  93.      NetWare 386.
  94.  
  95.    ■ Debug the NLM code under NetWare 386 using the
  96.      built-in symbolic debugger or Watcom's remote
  97.      debugger (available 1Q 1990).
  98.  
  99. Note that in these steps the NLM is linked with only one
  100. module (Prelude) from the C RunTime Libraries.
  101.  
  102. An NLM that uses the NetWare 386 C RunTime libraries
  103. consist of the following pieces, at minimum:
  104.  
  105.    ■ Prelude module, supplied with the Developers Kit
  106.    ■ Developer-written module that contains the function
  107.      main
  108.  
  109. When the NLM is loaded under NetWare 386, the Prelude
  110. module gets control because it is defined as the NLM
  111. start procedure.  The Prelude module can perform the
  112. following tasks:
  113.  
  114.    ■ Allocate and initialize all necessary NetWare 386
  115.      C RunTime Library data structures
  116.  
  117.    ■ Open a screen
  118.  
  119.    ■ Allocate a stack
  120.  
  121.    ■ Create a thread
  122. The thread created by Prelude executes the main function
  123. of the NLM.  Then, this main function or any developer-
  124. written function can call any of the procedures in the
  125. NetWare 386 C RunTime libraries.  Additional threads can
  126. also be created with BeginThread, and threads can
  127. terminate themselves or the entire NLM.
  128.  
  129. Types of NLMs
  130.  
  131. There are four basic types of NetWare Loadable Modules,
  132. and NetWare 386 includes a number of NLMs from each of
  133. these groups as shown below.  Notice that since NetWare
  134. 386 v3.0 provides support for multiple file name
  135. conventions, it includes one NLM for Macintosh naming
  136. conventions, while support for DOS and OS/2 are hard-
  137. coded in the NetWare OS.
  138. ---------------------------------------
  139.         TYPES OF NLM's
  140.  
  141. *  Utilities and application modules
  142.    (.NLM extension)
  143.  
  144.    DISKSET
  145.    INSTALL
  146.    MONITOR
  147.    PSERVER
  148.    UPS
  149.    VREPAIR
  150.    BTRIEVE
  151.  
  152. *  LAN drivers (.LAN extension)
  153.  
  154.    NE2
  155.    NE1000
  156.    NE2000
  157.    RXNET
  158.    TOKEN
  159.  
  160. *  Disk drivers (.DSK extension)
  161.  
  162.    DCB
  163.    DCB2
  164.    EDCB
  165.    ESDI
  166.    ISADISK
  167.  
  168. *  Modules pertaining to file system
  169.    name spaces (.NAM extension)
  170.  
  171.    MAC
  172.  
  173. ---------------------------------------
  174.  
  175.  
  176. Loading an NLM 
  177.  
  178. The flexibility and wide range of capabilities these
  179. various types of NLMs add to NetWare is perhaps most
  180. evident as you see how easily they are loaded.  Notice,
  181. for example, how simple it is to add a disk driver, a
  182. utility, and a LAN driver to the NetWare 386 core
  183. operating system, thus expanding the capability of the
  184. OS.  To load a disk driver, perform the following steps: 
  185.  
  186.    1)Boot a 386 machine with a DOS diskette in drive A.
  187.  
  188.    2)Replace the DOS diskette with the NetWare diskette
  189.      that includes the program SERVER.EXE, and type the
  190.      following at the DOS prompt.
  191.  
  192.         server <Enter>
  193.  
  194.    3)Insert a diskette that includes a disk driver.  For
  195.      example, ISADSK.DSK (Industry Standard
  196.      Architecture.DSK) in drive A, and type the following
  197.      at the NetWare prompt.
  198.  
  199.         load a:ISADISK.DSK <Enter>
  200.  
  201.    4)The ISADSK.DSK disk driver loadable module, provided
  202.      by Novell, is loaded.
  203.  
  204. The LOAD console command links ISADSK.DSK with the
  205. server's operating system, enabling the server to access
  206. the numerous hard disks attached to the associated disk
  207. controller.  The INSTALL utility (INSTALL.NLM) is just
  208. as simple.  As with the disk driver, the INSTALL utility
  209. is loaded from drive A and then linked to the operating
  210. system simply by typing load a:install <Enter>.  A
  211. supervisor uses the INSTALL utility to create and edit
  212. NetWare partitions on server hard disks and to create and
  213. edit disk volumes.  When the supervisor exits, INSTALL
  214. unloads itself from server memory and returns to the
  215. server all the memory it had previously allocated.
  216. And finally, by installing a LAN driver NLM, you have a
  217. basic, yet fully functioning 386 network.  To install the
  218. LAN driver, perform the following steps:
  219.  
  220.    1)Mount volume sys by typing
  221.  
  222.         mount volume sys <Enter>
  223.  
  224.    2)Insert a diskette that incudes a LAN driver (for
  225.      example, NE1000.LAN in drive A.
  226.  
  227.    3)Type the following at the NetWare prompt:
  228.  
  229.         load a:ne1000 <Enter>
  230.  
  231. Again, the LOAD command in the last step above links the
  232. LAN driver to the server's operating system and enables
  233. a supervisor to add other LAN boards without bringing
  234. down the server.  NetWare supports an unlimited number
  235. of LAN boards; however, hardware usually limits your
  236. server to 4 boards.    
  237.  
  238. The LAN driver (NE1000.LAN), the disk driver
  239. (ISADSK.DSK), and the INSTALL utility (INSTALL.NLM) are
  240. all NetWare Loadable Modules provided by Novell.  Thus,
  241. with NLMs you have a network with almost limitless
  242. options that can be added, deleted, and interchanged with
  243. one another to suit a particular environment.
  244.  
  245. It is also important to note here another type of NLM not
  246. yet mentioned: a group of NLMs called NetWare Service
  247. Enhancement Modules.  NetWare Service Enhancement Modules
  248. are server modules such as communication servers or print
  249. servers.  As with the other NLMs, NetWare Service
  250. Enhancement Modules become integral parts of NetWare. 
  251. This integration with the NetWare OS is an important
  252. advantage of NLMs.
  253.  
  254. For example, it allows for more speed, simplicity, and
  255. options to third party developers writing to the NetWare
  256. environment.  Yet because NLMs become an integral part
  257. of NetWare, and because they run in a nonpreemptive, or
  258. what is sometimes referred to as a "nice guy"
  259. environment, they must govern themselves.  The NLM must
  260. not take control of the CPU for indefinite periods of
  261. time, or spawn or destroy other processes
  262. indiscriminately.
  263.